package cn.xenosp.server.web.controller;

import cn.xenosp.server.common.Result;
import cn.xenosp.server.module.third_server.service.SystemInfoService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * 项目名： service-web
 * 包路径： cn.xenosp.server.web.controller
 * 作者：   TongHui
 * 创建时间: 2024-08-25 18:18
 * 描述: TODO
 * 版本: 1.0
 */
@RestController
@RequestMapping("${app.config.api-base-url}/system")
public class SystemInfoController {

    @Autowired
    SystemInfoService systemInfoService;

    @PostMapping("/info")
    public Result systemInfo(){
        try {
            return systemInfoService.systemInfo();
        } catch (Exception e) {
            e.printStackTrace();
        }
        return Result.error("请求失败","");
    }

    @PostMapping("/redis/info")
    public Result redisinfo(){
        try {
            return systemInfoService.redisinfo();
        } catch (Exception e) {
            e.printStackTrace();
        }
        return Result.error("请求失败","");
    }

    @PostMapping("/redis/keys")
    public Result rediskeys(){
        try {
            return systemInfoService.rediskeys();
        } catch (Exception e) {
            e.printStackTrace();
        }
        return Result.error("请求失败","");
    }

    @PostMapping("/jvm/info")
    public Result jvminfo(){
        try {
            return systemInfoService.jvmInfo();
        } catch (Exception e) {
            e.printStackTrace();
        }
        return Result.error("请求失败","");
    }
}
